import unittest,time
from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
class A3mall(unittest.TestCase):
    def setUp(self) -> None:
        self.driver=webdriver.Edge()
        self.driver.get('http://10.59.9.12:7001/')
        self.driver.maximize_window()
    def tearDown(self) -> None:
        time.sleep(2)
        self.driver.quit()
    def test_A3mall_01_login(self):
        self.driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
        self.driver.find_element(By.NAME,'username').send_keys('13012558376')
        self.driver.find_element(By.NAME,'password').send_keys('123456Aa')
        time.sleep(10)
        self.driver.find_element(By.CLASS_NAME,'finish-btn').click()
        time.sleep(5)
        dy1=self.driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').text
        print("断言1：",dy1)
        time.sleep(3)
        # ¥ 9999999983.00
        dy2=self.driver.find_element(By.XPATH,'/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[4]/span').text
        dy21=dy2.replace('¥ ','')
        print("断言2：",dy21)

    def test_A3mall_02_login(self):
        self.test_A3mall_01_login()
        self.driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/ul/li[1]/a').click()
        a1=self.driver.find_element(By.CLASS_NAME,'search-input')
        a1.send_keys('宋牌')
        a1.send_keys(Keys.ENTER)
        self.driver.find_element(By.XPATH,'//img[@src="/uploads/images/20250620/67e1bd127f10d17039e45464df4c460a.jpg"]').click()
        dy3=self.driver.find_element(By.XPATH,'/html/body/div[4]/a[4]').text
        print("断言3：",dy3)
        self.driver.find_element(By.ID,'buy-cart').click()
        dy4=self.driver.find_element(By.XPATH,'/html/body/div[4]/div[1]/a[2]').text
        print("断言4：",dy4)
        self.driver.find_element(By.CLASS_NAME,'radio-select-btn').click()
        self.driver.find_element(By.CLASS_NAME,'ask-btn').click()
        time.sleep(3)

if __name__ == '__main__':
    unittest.main()